package cn.app.web.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.app.entity.DevUser;
import cn.app.service.DevUserService;

@Controller
@RequestMapping("/devlogin")
public class DevUserController {

	@Autowired
	private DevUserService devUserService;

	// 转跳登陆页面
	@RequestMapping("/disLogin")
	public String disLogin() {

		return "dev/devLogin";
	}

	// 页面登陆
	@RequestMapping("/login")
	public String login(String devcode, String devpassword, HttpSession session) {
		DevUser devUser = devUserService.findAll(devcode, devpassword);
		if (devUser != null) {
			session.setAttribute("devUser", devUser);
			return "dev/main";

		} else {
			return null;
		}
	}

	// 测试主页jsp
	@RequestMapping("/pppp")
	public String ppppp() {
		return "dev/main";
	}

}
